//
//  UIView+Category.h
//  VICategory
//
//  Created by lan's Mac on 2022/7/20.
//

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, VIShadowPathSide) {
    VIShadowPathLeft,
    VIShadowPathRight,
    VIShadowPathTop,
    VIShadowPathBottom,
    VIShadowPathNoTop,
    VIShadowPathAllSide
};

@interface UIView (Category)

#pragma mark - frame

@property (nonatomic) CGFloat left;        ///< Shortcut for frame.origin.x.
@property (nonatomic) CGFloat top;         ///< Shortcut for frame.origin.y
@property (nonatomic) CGFloat right;       ///< Shortcut for frame.origin.x + frame.size.width
@property (nonatomic) CGFloat bottom;      ///< Shortcut for frame.origin.y + frame.size.height
@property (nonatomic) CGFloat width;       ///< Shortcut for frame.size.width.
@property (nonatomic) CGFloat height;      ///< Shortcut for frame.size.height.
@property (nonatomic) CGFloat centerX;     ///< Shortcut for center.x
@property (nonatomic) CGFloat centerY;     ///< Shortcut for center.y
@property (nonatomic) CGPoint origin;      ///< Shortcut for frame.origin.
@property (nonatomic) CGSize  size;        ///< Shortcut for frame.size.

- (void)removeAllSubviews;

/// 设置阴影
/// @param shadowColor 阴影颜色
/// @param shadowOpacity 阴影透明度，默认0
/// @param shadowRadius 阴影半径，默认3
/// @param shadowPathSide 设置哪一侧的阴影
/// @param shadowPathWidth 阴影的宽度
- (void)vi_setShadowPathWith:(UIColor *)shadowColor
               shadowOpacity:(CGFloat)shadowOpacity
                shadowRadius:(CGFloat)shadowRadius
                  shadowSide:(VIShadowPathSide)shadowPathSide
             shadowPathWidth:(CGFloat)shadowPathWidth;

/// 找到当前的控制器
+ (UIViewController *)vi_findCurrentViewController;


/// 添加一个table
- (UITableView *)addTable;
- (UITableView *)addTableStyle:(UITableViewStyle)style;


/// 添加一个collectionView
- (UICollectionView *)addCollection;
- (UICollectionView *)addCollectionWithScrollDirection:(UICollectionViewScrollDirection)scrollDirection;

- (UIView *)addWhiteView;
- (UIView *)addDefaultView;
- (UIView *)addViewColor:(nullable UIColor *)color;

- (UILabel *)addLabelTextColor:(nullable UIColor *)textColor fontSize:(CGFloat)fontSize;
- (UILabel *)addLabelTextColor:(nullable UIColor *)textColor
                      fontSize:(CGFloat)fontSize
                    fontWeight:(UIFontWeight)fontWeight;

- (UIImageView *)addImgV;
- (UIImageView *)addImgVWithImage:(UIImage *)image;
- (UIImageView *)addImgVWithImageName:(nullable NSString *)name;

- (UIButton *)addButtonFontSize:(CGFloat)fontSize
                    normalTitle:(nullable NSString *)normalTitle
                    normalColor:(nullable UIColor *)normalColor;
- (UIButton *)addButtonFontSize:(CGFloat)fontSize
                    normalTitle:(nullable NSString *)normalTitle
                    normalColor:(nullable UIColor *)normalColor
                   cornerRadius:(CGFloat)radius;

- (UIButton *)addButtonNormalImage:(nullable UIImage *)normalImage;
- (UIButton *)addButtonNormalImage:(nullable UIImage *)normalImage
                       selectImage:(nullable UIImage *)selectImage;
- (UIButton *)addButtonNormalImage:(nullable UIImage *)normalImage
                       normalTitle:(nullable NSString *)normalTitle
                  normalTitleColor:(nullable UIColor *)normalTitleColor;

- (UIButton *)addButtonFontSize:(CGFloat)fontSize
                    normalTitle:(nullable NSString *)normalTitle
                    selectTitle:(nullable NSString *)selectTitle
                    normalColor:(nullable UIColor *)normalColor
                    selectColor:(nullable UIColor *)selectColor
                    normalImage:(nullable UIImage *)normalImage
                    selectImage:(nullable UIImage *)selectImage
                   cornerRadius:(CGFloat)radius;
/// 切圆角
/// @param radius 圆角半径
- (void)roundCorner:(CGFloat)radius;

/// 绘制虚线
/// @param lineView 需要绘制成虚线的view
/// @param lineLength 虚线的宽度
/// @param lineSpacing 虚线的间距
/// @param lineColor 虚线的颜色
+ (void)drawDashLine:(UIView *)lineView lineLength:(NSInteger)lineLength lineSpacing:(NSInteger)lineSpacing lineColor:(UIColor *)lineColor;
@end

NS_ASSUME_NONNULL_END
